package com.simulate2.demo.dao;

import com.simulate2.demo.entity.Orders;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.query.Procedure;

import java.math.BigDecimal;
import java.util.List;

public interface OrderDao extends JpaRepository<Orders,Integer> {
    List<Orders> findByTime(int date);

    /*@Procedure
    Integer plus1inout(Integer arg);*/

    @Query(value = "SELECT SUM(price*ratio) FROM orders where time= ?1", nativeQuery = true)
    BigDecimal getAllCommision(int date);
}
